# !/usr/bin/env python
# _*_ coding:utf-8 _*_


# 加解密TimedJSONWebSignatureSerializer 有过期时间

# 1.导包
from itsdangerous import TimedJSONWebSignatureSerializer

# 2.实例化 加密对象
s = TimedJSONWebSignatureSerializer(secret_key="abc", expires_in=3600 * 10)

# 3.加密
data_dict = {'a':'1'}
# bbytes -- >decode()--str
dumps_result = s.dumps(data_dict)

print(dumps_result)
print(type(dumps_result))

# 4.解密
loads_result = s.loads(dumps_result)

print(loads_result)
print(type(loads_result))

